package models

import (
	__ "appointment-srv/basic/proto"
	"gorm.io/gorm"
)

type Doctor struct {
	gorm.Model
	DoctorName          string `gorm:"type:varchar(7);comment:'医生姓名'"`
	Phone               string `gorm:"type:char(11);unique;comment:'手机号'"` //唯一索引保障登录唯一性，
	HospitalId          int    `gorm:"type:int;comment:'医院id'"`
	OpenId              int    `gorm:"type:int;comment:'微信'"`
	Specialty           string `gorm:"type:varchar(20);comment:'	擅长领域'"`
	BindStatus          int    `gorm:"type:int;comment:'绑定状态 0 未绑定微信 1 已绑定'"`
	LicenseNo           string `gorm:"type:varchar(90);unique;comment:'执业医生证号'"`
	QualificationStatus int    `gorm:"type:int;comment:'资质状态 0 待审核 1 已通过 2 未通过'"`
	ServiceStatus       int    `gorm:"type:int;comment:'问诊状态 0 在线 1 忙碌 2 离线 3 禁用'"`
	AvatarUrl           string `gorm:"type:varchar(90);unique;comment:'头像'"`
	Introduction        string `gorm:"type:varchar(90);unique;comment:'简介'"`
}
type Hospital struct {
	gorm.Model
	HospitalName      string `gorm:"type:varchar(7);unique;comment:'医院姓名'"`
	Level             string `gorm:"type:varchar(11);comment:'医院等级'"`
	Province          string `gorm:"type:varchar(10);comment:'所在省份'"`
	City              string `gorm:"type:varchar(90);comment:'在的城市1'"`
	Address           string `gorm:"type:varchar(20);comment:'	详细地址1'"`
	Phone             string `gorm:"type:char(11);comment:'联系电话'"`
	CooperationStatus int    `gorm:"type:int;comment:'合作状态'"`
	Introduction      string `gorm:"type:varchar(90);unique;comment:'简介'"`
}

func (h *Hospital) GetList(db *gorm.DB, page int, pagesize int) (list []*__.HospitalList, err error) {
	err = db.Model(&Hospital{}).Scopes(Paginate(page, pagesize)).Find(&list).Error
	return
}

func (o *Doctor) Getlists(db *gorm.DB) (list []*__.DoctorList, err error) {
	err = db.Model(&Doctor{}).Find(&list).Error
	return
}
